#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QFile>


QT_BEGIN_NAMESPACE
namespace Ui {
class TcpClient;
}
QT_END_NAMESPACE

class TcpClient : public QMainWindow
{
    Q_OBJECT

public:
    TcpClient(QWidget *parent = nullptr);
    ~TcpClient();
    void loadConfig();

    //单例模式
    static TcpClient &getInstance();

    QTcpSocket &getTcpSocket();
    QString getloginName();
    QString getCurPath();
    void setCurPath(QString strNewCurPath);

public slots:
    void showConnect();
    void recvMsg();

private slots:
    //void on_send_pd_clicked();

    void on_login_pd_clicked();

    void on_register_pd_clicked();

    void on_cancel_pd_clicked();

private:
    Ui::TcpClient *ui;
    QString m_strIP;
    quint16 m_usPort;

    //连接服务器和服务器数据交互
    QTcpSocket m_tcpSocket;
    QString m_strLoginName;

    QString m_strCurPath;
    QFile m_file;
};
#endif // TCPCLIENT_H
